import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'

import { NavLink, useNavigate } from 'react-router-dom'

function App() {
  const [count, setCount] = useState(0)
  // 使用编程式Api的跳转方式

  const navgate = useNavigate();
  const handleFun = ()=>{
    navgate("/react");
  }
  return (
    <>
      <div>
        <NavLink to="/vite">
          <img src={viteLogo} className="logo" alt="Vite logo" />
        </NavLink>
        <NavLink to="/react">
          <img src={reactLogo} className="logo react" alt="React logo" />
        </NavLink>
      </div>
      <h1>Vite + React</h1>
      <div className="card">
        <button onClick={handleFun}>跳转到react页面，使用编程式导航</button>
        <p>
          Edit <code>src/App.tsx</code> and save to test HMR
        </p>
      </div>
      <p className="read-the-docs">
        Click on the Vite and React logos to learn more
      </p>
    </>
  )
}

export default App
